from common import *

def Gate_XORFunc(in0, in1, out0):
    while 1:
        # Get value 1
        alt = Alternation([{in0:None, in1:None}])
        (ret, msg) = alt.select()

        val1 = int(msg)

        # Get value 2
        if (ret == in0):
            val2 = int(in1())
        else:
            val2 = int(in0())
            
        # Out
        result = (val1 and (not val2)) or (val2 and (not val1))
        if result:
            out0(1)
        else:
            out0(0)
        
